{% extends "base.html" %}

{% block title %}个人资料 - XbyJob{% endblock %}

{% block content %}
<div class="py-3">
    <h2><i class="fas fa-user-circle me-2"></i>个人资料</h2>
    
    <div class="row">
        <div class="col-md-8">
            <div class="card">
                <div class="card-header">
                    <h5><i class="fas fa-info-circle me-2"></i>基本信息</h5>
                </div>
                <div class="card-body">
                    <div class="row mb-3">
                        <div class="col-sm-3">
                            <strong>用户名:</strong>
                        </div>
                        <div class="col-sm-9">
                            {{ user.username }}
                        </div>
                    </div>
                    
                    <div class="row mb-3">
                        <div class="col-sm-3">
                            <strong>邮箱:</strong>
                        </div>
                        <div class="col-sm-9">
                            {{ user.email }}
                        </div>
                    </div>
                    
                    <div class="row mb-3">
                        <div class="col-sm-3">
                            <strong>用户类型:</strong>
                        </div>
                        <div class="col-sm-9">
                            {% if user.is_admin %}
                                <span class="badge bg-danger">管理员</span>
                            {% else %}
                                <span class="badge bg-secondary">普通用户</span>
                            {% endif %}
                        </div>
                    </div>
                    
                    <div class="row mb-3">
                        <div class="col-sm-3">
                            <strong>账户状态:</strong>
                        </div>
                        <div class="col-sm-9">
                            {% if user.is_active %}
                                <span class="badge bg-success">正常</span>
                            {% else %}
                                <span class="badge bg-danger">已禁用</span>
                            {% endif %}
                        </div>
                    </div>
                    
                    <div class="row mb-3">
                        <div class="col-sm-3">
                            <strong>注册时间:</strong>
                        </div>
                        <div class="col-sm-9">
                            {{ user.created_at.strftime('%Y-%m-%d %H:%M:%S') }}
                        </div>
                    </div>
                    
                    <div class="row mb-3">
                        <div class="col-sm-3">
                            <strong>最后登录:</strong>
                        </div>
                        <div class="col-sm-9">
                            {% if user.last_login %}
                                {{ user.last_login.strftime('%Y-%m-%d %H:%M:%S') }}
                            {% else %}
                                从未登录
                            {% endif %}
                        </div>
                    </div>
                </div>
            </div>
        </div>
        
        <div class="col-md-4">
            <div class="card">
                <div class="card-header">
                    <h5><i class="fas fa-cog me-2"></i>操作</h5>
                </div>
                <div class="card-body">
                    <div class="d-grid gap-2">
                        <a href="{{ url_for('auth.change_password') }}" class="btn btn-primary">
                            <i class="fas fa-key me-2"></i>修改密码
                        </a>
                        <a href="{{ url_for('dashboard.overview') }}" class="btn btn-secondary">
                            <i class="fas fa-arrow-left me-2"></i>返回首页
                        </a>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
{% endblock %}